package com.xyz.comsumer.feign.factory;

import com.xyz.comsumer.feign.RemoteHelloService;
import com.xyz.comsumer.feign.fallback.RemoteHelloServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author beibei
 */
@Component
public class RemoteHelloServiceFallbackFactory implements FallbackFactory<RemoteHelloService> {

    @Override
    public RemoteHelloService create(Throwable throwable) {
        RemoteHelloServiceFallbackImpl remoteFallback = new RemoteHelloServiceFallbackImpl();
        remoteFallback.setCause(throwable);
        return remoteFallback;
    }
}
